using B.S.XZYData.ErrorCode;
using MediatR;
using System;
using System.Collections.Generic;
using B.S.XZYData.Domain.ZSH;

namespace B.S.XZYData.Api.Wrter.Application.Command.WorkReport
{
    /// <summary>
    /// 新增报工命令（含不良品项子表）
    /// </summary>
    public class AddWorkReportCommand : IRequest<ApiResult<int>>
    {
        // --- 报工主表字段 ---
        public string WorkOrderCode { get; set; }
        public string ProcessName { get; set; }
        public string ProductCode { get; set; }
        public string? ProductNo { get; set; }
        public string? ProductName { get; set; }
        public string? ProductSpec { get; set; }
        public int ReportQty { get; set; }
        public string Producer { get; set; }
        public string? Unit { get; set; }
        public int GoodQty { get; set; }
        public int DefectiveQty { get; set; }
        public ProcessStatusEnum ProcessStatus { get; set; } = ProcessStatusEnum.NotStarted;
        public string? ProcessProgress { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime? EndTime { get; set; }
        public decimal ReportHours { get; set; }
        public int ReportMinutes { get; set; }
        public decimal StandardEfficiency { get; set; }
        public decimal ActualEfficiency { get; set; }
        public decimal ComplianceRate { get; set; }
        public PricingMethodEnum PricingMethod { get; set; } = PricingMethodEnum.ByPiece;
        public decimal WageUnitPrice { get; set; }
        public decimal EstimatedWage { get; set; }
        public decimal BonusAmount { get; set; }
        public decimal PenaltyAmount { get; set; }
        public int CreatorId { get; set; }

        /// <summary>
        /// 不良品项列表
        /// </summary>
        public List<DefectiveItemDto>? DefectiveItems { get; set; }

        /// <summary>
        /// 不良品项 DTO
        /// </summary>
        public class DefectiveItemDto
        {
            public string DefectiveCode { get; set; }
            public int DefectiveQty { get; set; }
        }
    }
} 